<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div></div>
    <script>
        const gift = '50g的茶叶,清洗球';
        // const str = gift.split(',').map(function (item) {
        //     return `<span>${item}</span><br>`
        // }).join('');
        const str = gift.split(',').map(item => `<span>${item}</span><br>`).join('');

        document.querySelector('div').innerHTML = str;
    </script>
</body>

</html>